//
//  CZComment.swift
//  GZWeibo007
//
//  Created by JLHong on 15/12/24.
//  Copyright © 2015年 Apple. All rights reserved.
//

import UIKit

class CZComment: NSObject {
    
    /// 评论的ID
    var id: Int = 0
    
    /// 评论创建时间
    var created_at: String?
    
    /// 评论作者的用户信息字段
    var user: CZUser?
    
    /// 内容
    var text: String?
    
    /// 字典转模型
    init(dict: [String: AnyObject]) {
        super.init()
        
        // KVC字典转模型
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forKey key: String) {
        if key == "user" {
            if let dict = value as? [String: AnyObject] {
                user = CZUser(dict: dict)
            }
            return
        }
        
        super.setValue(value, forKey: key)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {}
    
    override var description: String {
        let properties = ["id", "created_at", "user"]
        
        return "\n\t:评论模型: \(dictionaryWithValuesForKeys(properties))"
    }
    
    // MARK: - 获取数据
    ///  模型获取数据
    class func loadComment(statusId: Int, since_id: Int, max_id: Int, finished:(comment: [CZComment]? , error: NSError?) -> ()) {
        
        

  }
}